<?php
/**
 * @link http://www.tpframe.com/
 * @copyright Copyright (c) 2017 TPFrame Software LLC
 * @author 510974211@qq.com
 */
namespace app\backend\controller;
use app\common\controller\AdminBase;
use \tpfcore\Core;
class BankList extends AdminBase
{
    public function index(){
        if(IS_GET) return $this->fetch('index',[
            'cardType'=> json_encode([
                ['id'=>1,'name'=>'银行卡'],
                ['id'=>2,'name'=>'支付宝'],
                ['id'=>3,'name'=>'微信'],
            ])
        ]);
        if(IS_POST || IS_AJAX){
            $this->jump([0,"success",Core::loadModel($this->name,"common","logic")->getBankList([
                'paginate'=>['rows' => 30],
                "order"=>"id desc"
            ])]);
      }
    }

    public function add(){
        if(IS_GET) return $this->fetch('add',[
            'cardType'=> json_encode([
                ['id'=>1,'name'=>'银行卡'],
                ['id'=>2,'name'=>'支付宝'],
                ['id'=>3,'name'=>'微信'],
            ])
        ]);
        if(IS_POST || IS_AJAX){
            $this->jump(Core::loadModel($this->name,"common","logic")->saveBankList($this->param));
        }
    }

    public function del(){
        $this->jump(Core::loadModel($this->name,"common","logic")->del($this->param));
    }
}
?>